home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / ab20_archive / utilities / emulators / apple2emul.lzh / Snarf < prev    next >
Text File  |  1991-04-18  |  3KB  |  108 lines

  1. Snarfing the ROM images
  2. -----------------------
  3.  
  4. In order to run the Apple II emulator you will need several ROM images.
  5. Since they are copyrighted they cannot be distributed with this program.
  6.  
  7.  
  8. File to put image in            Location in Apple
  9.  
  10. AUTOSTART.ROM                F800-FFFF
  11. APPLESOFT.ROM                D000-EFFF
  12. DISK.PROM                C600-C6FF    (slot 6 Disk II cont.)
  13.  
  14. MONITOR.ROM                F800-FFFF    (old Apples)
  15. INTEGER.ROM                D000-EFFF    (old Apples)
  16.  
  17.  
  18. How I snarfed the ROMs:
  19.  
  20. My Apple has an el-cheapo serial card; neither Kermit nor any of my
  21. communications programs would talk to it.  If I'd had any sort of working
  22. communications software when I set out to snarf my ROMs I probably wouldn't
  23. have done it this way; as it turns out, however, I've been very happy
  24. with this method.
  25.  
  26. I have my Apple connected to my Unix box through the serial card.  I
  27. can type IN#2 on my apple and cu into it from the Unix machine (typing
  28. PR#2 once I'm connected).
  29.  
  30. Once I'm cu'd in, it's easy to use the ROM monitor to dump stuff.  It
  31. looks something like this:
  32.  
  33.     $ cu -l /dev/tty06 -s 9600 -e | tee log
  34.     Connected
  35.     <type PR#2>
  36.     ]CALL -151
  37.  
  38.     *F800.FFFF
  39.  
  40.     F800-  00 00 00 ...
  41.     ...
  42.     *
  43.  
  44. Then when I escape back to the Unix side I have a log of the session
  45. in "log".  I use this sed command to strip off the junk and only leave
  46. the hex data:
  47.  
  48.     sed -n -e 's/^M$//' -e '/^[0-9A-F]...-/p'
  49.  
  50. In other words, put the above in a file, say 'fix', chmod +w fix, and say:
  51.  
  52.     fix < log > foo
  53.  
  54. Then I run the hex dump through a simple C program to turn it back into
  55. binary (the program is called hex.c, and should be in the directory with
  56. the emulator source):
  57.  
  58.     hex < foo > AUTOSTART.ROM
  59.  
  60. I snarf disk images in much the same way.  Here's a little DOS 3.3
  61. routine to dump an entire disk in hex:
  62.  
  63.  
  64. 0300-   A9 00       LDA   #$00        ; set up IOB
  65. 0302-   8D F0 B7    STA   $B7F0        ; BUFFL
  66. 0305-   8D EB B7    STA   $B7EB        ; VOLUME
  67. 0308-   8D EC B7    STA   $B7EC        ; TRACK
  68. 030B-   8D ED B7    STA   $B7ED        ; SECTOR
  69. 030E-   A9 10       LDA   #$10
  70. 0310-   8D F1 B7    STA   $B7F1        ; BUFFH
  71. 0313-   A9 B7       LDA   #$B7        ; IOBH
  72. 0315-   A0 E8       LDY   #$E8        ; IOBL
  73. 0317-   20 B5 B7    JSR   $B7B5        ; call RWTS
  74. 031A-   EE F1 B7    INC   $B7F1        ; next page of memory
  75. 031D-   EE ED B7    INC   $B7ED        ; next sector
  76. 0320-   AD ED B7    LDA   $B7ED
  77. 0323-   C9 10       CMP   #$10        ; end of track?
  78. 0325-   90 EC       BCC   $0313
  79. 0327-   20 3A 03    JSR   $033A        ; dump 1000-1FFF in hex
  80. 032A-   A9 00       LDA   #$00        ; Start at sector 0 again
  81. 032C-   8D ED B7    STA   $B7ED
  82. 032F-   EE EC B7    INC   $B7EC        ; next track
  83. 0332-   AD EC B7    LDA   $B7EC
  84. 0335-   C9 23       CMP   #$23        ; last track on disk?
  85. 0337-   90 D5       BCC   $030E
  86. 0339-   60          RTS   
  87. 033A-   A9 00       LDA   #$00
  88. 033C-   85 3C       STA   $3C
  89. 033E-   A9 FF       LDA   #$FF        ; range 1000-1FFF
  90. 0340-   85 3E       STA   $3E
  91. 0342-   A9 10       LDA   #$10
  92. 0344-   85 3D       STA   $3D
  93. 0346-   A9 1F       LDA   #$1F
  94. 0348-   85 3F       STA   $3F
  95. 034A-   20 B3 FD    JSR   $FDB3        ; dump hex region
  96. 034D-   60          RTS   
  97.  
  98. Run fix and hex on the log, and you can put together binary disk images
  99. for the emulator.  I've converted about 45 of my disks this way.
  100.  
  101. Since the emulator expects disk images to be in DOS 3.3 sector ordering,
  102. if you use another tool to snarf disk you may need to convert them.
  103. The program mapper.c converts from Prodos sector ordered disks into
  104. DOS 3.3 sector ordered images:
  105.  
  106.     mapper < foo > bar
  107.  
  108.